package com.example.ceedataanalysis.service.impl;

import com.example.ceedataanalysis.entity.SchoolRank;
import com.example.ceedataanalysis.mapper.SchoolRankMapper;
import com.example.ceedataanalysis.service.ISchoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SchoolServiceImpl implements ISchoolService {

    @Autowired
    private SchoolRankMapper mapper;

    @Override
    public List<SchoolRank> getTotalRank() {
        List<SchoolRank> list = mapper.getTotalRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 19; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getKeyLaboratoryRank() {
        List<SchoolRank> list = mapper.getKeyLaboratoryRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getKeyDisciplineRank() {
        List<SchoolRank> list = mapper.getKeyDisciplineRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getMasterRank() {
        List<SchoolRank> list = mapper.getMasterRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getDoctorRank() {
        List<SchoolRank> list = mapper.getDoctorRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getJobRank() {
        List<SchoolRank> list = mapper.getJobRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getAbroadRank() {
        List<SchoolRank> list = mapper.getAbroadRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getPostgraduateRank() {
        List<SchoolRank> list = mapper.getPostgraduateRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getMenAndFemale() {
        return mapper.getMenAndFemale();
    }

    @Override
    public List<SchoolRank> getFemaleRateRank() {
        List<SchoolRank> list = mapper.getFemaleRateRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getTotalNumRank() {
        List<SchoolRank> list = mapper.getTotalNumRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getMenRank() {
        List<SchoolRank> list = mapper.getMenRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getFemaleRank() {
        List<SchoolRank> list = mapper.getFemaleRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }

    @Override
    public List<SchoolRank> getManRateRank() {
        List<SchoolRank> list = mapper.getManRateRank();
        List<SchoolRank> rankList = new ArrayList<>();
        for (int i = 14; i >= 0; i--) {
            rankList.add(list.get(i));
        }
        return rankList;
    }
}
